<template>
	<view :style="themeColor">
		<view class="page">
			<view :class="scrollTop > 50 ? 'scroll_bg' : ''" class="flex flex-direction align-stretch justify-between benben-position-layout flex home_flex_0"
				:style="{height:(93+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between home_fd0_0'>
					<image class='home_fd0_0_c0' mode="aspectFit" :src='STATIC_URL+"144.png"'></image>
					<text class='home_fd0_0_c1'>{{userInfo.depart_name}}</text>
					<view class='flex flex-wrap align-center flex-sub home_fd0_0_c2' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/homePage/searchye/searchye`">
						<image class='home_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"145.png"'></image>
						<benben-input class='flex-sub home_fd0_0_c2_c1' type="text" :placeholder="`请输入关键字搜索`"
							confirm-type="done" :maxlength="-1"
							placeholder-style="color:rgba(153, 153, 153, 1);font-size:28rpx" :disabled="true" />
					</view>
				</view>
			</view>
			<view :style="{height: (93+StatusBarRpx)+'rpx'}"></view>
			<view class="loading_css" v-if="isShow">
				<u-loading size="36" color="#E60012"></u-loading>
				<view>加载中</view>
			</view>
			<template v-else>
				<!---flex布局flex布局开始-->
				<view class="flex flex-wrap align-center justify-center benben-flex-layout home_flex_1">
					<view style="position: relative">
						<swiper ref="benbenSwiperfd1_0" :current='index'
							@change="bannerIndexfd1_0 = $event.detail.current" class='flex position-relative home_fd1_0'
							previous-margin="0rpx" next-margin="0rpx" :display-multiple-items="1" :interval="5000"
							:duration="500" :autoplay='true' :circular='true'>

							<template v-for='(item,key0) in dataRotograph'>
								<swiper-item class='flex  home_fd1_0' :key='key0'>
									<image class='home_fd1_0_c1_c0' mode="aspectFill" :src='item.thumb'
										@tap.stop="gothumbFunc(item.href)"></image>
								</swiper-item>
							</template>

						</swiper>
						<view style="position: absolute"
							class="flex dot flex align-center justify-center home_swiperDotfd1_0">
							<template v-for="(item, index) in (dataRotograph.length)">
								<view :key="index" v-if="bannerIndexfd1_0 == index"
									class="flex dot selected flex align-center justify-center home_swiperDotSelectedfd1_0">
								</view>
								<view :key="index" v-else
									class="flex dot unselected flex align-center justify-center home_swiperDotUnselectedfd1_0">
								</view>
							</template>
						</view>
					</view>
				</view>

				<!---flex布局flex布局结束-->
				<!---公告flex布局开始-->
				<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout home_flex_2"
					v-if="noticeList.length > 0">
					<view class='flex flex-wrap align-center home_fd2_0'>
						<image class='home_fd2_0_c0' mode="aspectFit" :src='STATIC_URL+"146.png"'></image>

						<view class='flex  home_fd2_0_c1'></view>

						<view style="position: relative">
							<swiper @change="bannerIndexfd2_0_c2 = $event.detail.current"
								class='flex position-relative home_fd2_0_c2' previous-margin="0rpx" next-margin="0rpx"
								:display-multiple-items="1" :vertical='true' :interval="5000" :duration="500"
								:autoplay='true' :circular='true'>
								<swiper-item class='flex  home_fd2_0_c2_c1_c0' v-for="(item, index) in noticeList"
									:key="index">
									<view class='flex flex-wrap align-center flex-sub home_fd2_0_c2_c1_c0'
										@tap.stop="handleJumpDiy" data-type="navigateTo"
										:data-url="`/pages/grzx/newDetail/newDetail?id=${item.aid}`">
										<text class='home_fd2_0_c2_c1_c0_c0'>{{item.title}}</text>
									</view>
								</swiper-item>
							</swiper>
						</view>
					</view>
				</view>

				<!---公告flex布局结束-->
				<!---flex布局flex布局开始-->
				<view class="flex benben-flex-layout flex-wrap align-center home_flex_3">
					<text class='home_fd3_0'>培训课程</text>
				</view>

				<!---flex布局flex布局结束-->
				<!---flex布局flex布局开始-->
				<view class="flex benben-flex-layout flex-wrap align-center home_flex_4">
					<view class='flex flex-wrap align-center home_fd4_0' v-for="(item, index) in list" :key="index"
						@tap.stop="handleJumpDiy" data-type="navigateTo"
						:data-url="`/pages/homePage/courseDetail/courseDetail?id=${item.aid}`">
						<view class='flex flex-wrap align-center'>
							<image class='home_fd4_0_c0_c0' mode="aspectFill" :src='item.thumb'></image>
						</view>
						<view class='flex flex-wrap align-center flex-sub home_fd4_0_c1'>
							<view class='flex flex-wrap align-center home_fd4_0_c1_c0'>
								<text class='home_fd4_0_c1_c0_c0'>{{item.title}}</text>
							</view>
							<view class='flex flex-wrap align-center home_fd4_0_c1_c1'>
								<text class='home_fd4_0_c1_c1_c0'>讲师名称：{{item.lecturer}}</text>

								<view class='flex  home_fd4_0_c1_c1_c1'></view>

								<text class='home_fd4_0_c1_c1_c0'>{{item.course_hour}}课时</text>
							</view>
						</view>
					</view>
				</view>
				<view class="loadmore" v-if="last_page > 1">
					<u-loadmore font-size="24" :status="status" :icon-type="iconType" :load-text="loadText" />
				</view>
			</template>
			<view class="noData_other" v-if="list.length == 0 && !isShow">
				<image :src='STATIC_URL+"no.png"'></image>
			</view>
			<!---flex布局flex布局结束-->
		</view>

		<benben-popup v-model="popupShow1656992350800" :mask="true" :mask-close-able="true" mode='center'>
			<!---退出登录flex布局开始-->
			<view class="flex flex-direction flex-wrap align-center system_flex_4"
				@tap.stop="popupShow1650940432200=true">
				<text class='system_fd4_0'>提示</text>
				<text class='system_fd4_1'>是否继续学习？</text>
				<view class='flex align-center system_fd2_2'>
					<button class='system_fd4_2_c0' @tap.stop="popupShow1656992350800=false">取消</button>
					<button class='system_fd4_2_c1' @tap.stop="confirmStudy">继续学习</button>
				</view>
			</view>

		</benben-popup>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},

		data() {
			return {
				"popupShow1656992350800": false,
				"bannerIndexfd2_0_c2": 0,
				"bannerIndexfd1_0": 0,
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				"index": 0,
				"dataRotograph": [],
				"cid": "0",
				"dataList": [],
				"secondaryClassifieds": {
					"category_list": [],
					"ad_list": [],
					"diy_category_list": []
				},
				"goods_type": "",
				"dataGoodsList": [],
				"popupContent": {
					"file_url": []
				},
				"scrollTop": 0,

				"noticeList": [],
				"userInfo": {},
				"list": [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": true,
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {
			popupShow1656992350800() {
				if (this.popupShow1656992350800) {
					uni.hideTabBar();
				} else {
					uni.showTabBar();
				}
			}
		},
		onLoad(options) {
			if (!global.token) {
				uni.redirectTo({
					url: '/pages/tabBar/loginPage/loginPage'
				})
			} else {
				this.queryRotographFunc();
				this.getList();
				this.getNotice();
				this.getStudyStatus();
			}
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			if (global.token) {
				this.queryUserInfoFunc();
			}
		},
		onHide() {

		},
		onResize() {

		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getList();
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {

				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.getList();
			}, 500)
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		methods: {
			// 获取首页弹窗  post65ead5e0f2bf9
			getStudyStatus() {
				this.$api.post(global.apiUrls.post65ead5e0f2bf9, {

				}).then(res => {
					// console.log(res);
					if (res.data.code == 1) {
						if (!res.data.data) {

						} else {
							this.popupContent = res.data.data;
							this.popupShow1656992350800 = true;
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},


			//获取轮播图
			async queryRotographFunc() {
				//请求方法
				//数据验证

				let datadataRotograph = await this.$api.get(global.apiUrls.post641e624160dd0, {
					type: '1'
				});

				if (datadataRotograph.data.code != 1) {
					this.$message.info(datadataRotograph.data.msg);
					return
				}
				let infodataRotograph = datadataRotograph.data;
				this.dataRotograph = infodataRotograph.data
			},
			//获取用户详细信息
			async queryUserInfoFunc() {
				let datauserInfo = await this.$api.get(global.apiUrls.post5c78c4772da97, {

				});
				if (datauserInfo.data.code != 1) {
					this.$message.info(datauserInfo.data.msg);
					return
				}
				let infouserInfo = datauserInfo.data;
				this.userInfo = infouserInfo.data
			},
			//轮播图跳转
			gothumbFunc(url) {
				if (url != '') {
					this.dynamicJump(url);
				}
			},

			// 获取课程列表  post65dd81e6f0119
			getList() {
				this.$api.post(global.apiUrls.post65dd81e6f0119, {
					page: this.page
				}).then(res => {
					// console.log(res);
					uni.stopPullDownRefresh();
					this.isShow = false;
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.list = res.data.data.data;
						} else {
							this.list = this.list.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},

			// 首页公告列表  post65e6e9ce4d8f2
			getNotice() {
				this.$api.post(global.apiUrls.post65e6e9ce4d8f2, {

				}).then(res => {
					// console.log(res);
					if (res.data.code == 1) {
						this.noticeList = res.data.data;
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			confirmStudy() {
				this.popupShow1656992350800 = false;
				uni.showTabBar();
				uni.setStorageSync('fileUrl', this.popupContent.file_url[0]);
				if (this.popupContent.type == 1) {
					uni.navigateTo({
						url: '/pages/homePage/seeVideo/seeVideo?id=' + this.popupContent.chapter_id + '&name=' +
							this.popupContent.course_title + '&course_id=' + this.popupContent.course_id +
							'&watchTime=' + this.popupContent.duration
					})
				} else if (this.popupContent.type == 2) {
					uni.navigateTo({
						url: '/pages/homePage/seeVideo/pdf?id=' + this.popupContent.chapter_id + '&name=' + this
							.popupContent.course_title + '&course_id=' + this.popupContent.course_id
					})
				}
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: url(image-path('137.png')) no-repeat;
		background-size: 100% auto;
	}

	.home_flex_0 {
		width: 750rpx;
		height: 93rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		// background: url(imag0e-path('137.png')) no-repeat;
		// background-size: 100% auto;
	}

	.scroll_bg {
		background: #f6ebec;
	}

	.home_fd0_0_c2_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		transform: translateY(3rpx);
	}

	.home_fd0_0_c2_c0 {
		width: 48rpx;
		height: 48rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.home_fd0_0_c2 {
		background: rgba(249, 249, 249, 1);
		height: 72rpx;
		background-size: 100% auto !important;
		border-radius: 34rpx 34rpx 34rpx 34rpx;
		padding: 0rpx 24rpx 0rpx 24rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		width: 514rpx;
	}

	.home_fd0_0_c1 {
		font-size: 28rpx;
		color: rgba(102, 102, 102, 1);
		margin: 0rpx 20rpx 0rpx 0rpx;
	}

	.home_fd0_0_c0 {
		width: 48rpx;
		height: 48rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 12rpx 0rpx 0rpx;
	}

	.home_fd0_0 {
		padding: 0rpx 36rpx 0rpx 36rpx;
		line-height: 93rpx;
	}

	.home_flex_1 {
		margin: 32rpx 36rpx 20rpx 36rpx;
	}

	.home_numberfd1_0_c0 {
		background: #525050;
		position: absolute;
		bottom: 20rpx;
		right: 30rpx;
		width: 80rpx;
		height: 40rpx;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		line-height: 46rpx;
		font-weight: 400;
	}

	.home_fd1_0_c1_c0 {
		width: 678rpx;
		height: 274rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.home_fd1_0 {
		width: 678rpx;
		height: 274rpx;
		overflow: hidden;
	}

	.home_swiperDotUnselectedfd1_0 {
		border: 2px solid #E60012;
		width: 14rpx;
		height: 14rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 6rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	.home_swiperDotSelectedfd1_0 {
		border: 2px solid var(--benbenbdColor1);
		width: 14rpx;
		height: 14rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 6rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	::v-deep .home_swiperDotfd1_0 {
		position: absolute;
		bottom: 20rpx;
		left: 0rpx;
		right: 0rpx;
	}

	.home_flex_2 {
		padding: 0rpx 36rpx 0rpx 36rpx;
		height: 60rpx;
	}

	.home_numberfd2_0_c2_c0 {
		background: #525050;
		position: absolute;
		bottom: 20rpx;
		right: 30rpx;
		width: 80rpx;
		height: 40rpx;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		line-height: 46rpx;
		font-weight: 400;
	}

	.home_fd2_0_c2_c1_c0_c0 {
		font-size: 24rpx;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		line-height: 33rpx;
	}

	.home_fd2_0_c2_c1_c0 {
		height: 42rpx;
	}

	.home_fd2_0_c2 {
		width: 480rpx;
		height: 42rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.home_swiperDotUnselectedfd2_0_c2 {
		border: 1px solid rgba(0, 0, 0, 0.3);
		background: rgba(0, 0, 0, 0.3);
		width: 16rpx;
		height: 16rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 6rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	.home_swiperDotSelectedfd2_0_c2 {
		border: 1px solid #00A7FF;
		background: #00A7FF;
		width: 16rpx;
		height: 16rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 6rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	::v-deep .home_swiperDotfd2_0_c2 {
		position: absolute;
		bottom: 20rpx;
		left: 0rpx;
		right: 0rpx;
	}

	.home_fd2_0_c1 {
		background: rgba(205, 205, 205, 1);
		width: 1rpx;
		height: 22rpx;
		margin: 0rpx 0rpx 0rpx 0rpx;
		transform: scaleX(0.5);
	}

	.home_fd2_0_c0 {
		width: 48rpx;
		height: 48rpx;
		margin: 0rpx 8rpx 0rpx 0rpx;
	}

	.home_fd2_0 {
		background: #fff;
		background-size: 100% auto;
		margin: 0rpx 0rpx 0rpx 0rpx;
		height: 60rpx;
		border-radius: 30rpx;
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.home_flex_3 {
		margin: 36rpx 36rpx 14rpx 36rpx;
	}

	.home_fd3_0 {
		font-size: 32rpx;
		color: rgba(102, 102, 102, 1);
	}

	.home_flex_4 {
		padding: 0rpx 36rpx 0rpx 36rpx;
	}

	.home_fd4_0_c1_c1_c1 {
		background: #999;
		width: 1rpx;
		height: 30rpx;
		margin: 0rpx 20rpx 0rpx 20rpx;
		transform: scaleX(0.5);
	}

	.home_fd4_0_c1_c1_c0 {
		font-size: 24rpx;
		color: rgba(153, 153, 153, 1);
	}

	.home_fd4_0_c1_c1 {
		width: 100%;
		margin: 18rpx 0rpx 0rpx 0rpx;
	}

	.home_fd4_0_c1_c0_c0 {
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		font-size: 28rpx;
		font-weight: 500;
	}

	.home_fd4_0_c1_c0 {
		width: 100%;
	}

	.home_fd4_0_c1 {
		margin: 0rpx 0rpx 0rpx 32rpx;
	}

	.home_fd4_0_c0_c0 {
		width: 250rpx;
		height: 168rpx;
		border-radius: 16rpx;
	}

	.home_fd4_0 {
		background: #fff;
		width: 100%;
		background-size: 100% auto;
		padding: 28rpx 32rpx 28rpx 32rpx;
		border-radius: 16rpx;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.system_flex_4 {
		background: #fff;
		width: 580rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding-bottom: 32rpx;
	}

	.system_fd4_2_c1 {
		width: 254rpx;
		height: 80rpx;
		background: #E60012;
		line-height: 80rpx;
		border-radius: 16rpx;
		font-size: 28rpx;
		color: #fff;
		margin-left: 12rpx;
	}

	.system_fd4_2_c0 {
		width: 254rpx;
		height: 80rpx;
		background: #F5F5F5;
		line-height: 80rpx;
		border-radius: 16rpx;
		font-size: 28rpx;
		color: #666;
		margin-right: 12rpx;
	}

	.system_fd4_2 {
		margin: 37rpx 0rpx 0rpx 0rpx;
	}

	.system_fd4_1 {
		line-height: 44rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.system_fd4_0 {
		font-size: 36rpx;
		font-weight: 600;
		line-height: 42rpx;
		color: #333333;
		margin: 40rpx 0rpx 40rpx 0rpx;
	}

	.system_fd2_2 {
		margin: 37rpx 0rpx 0rpx 0rpx;
	}
</style>